package;

import flash.text.TextFormat;
import flash.display.DisplayObjectContainer;


/**
 * ...
 * @author 
 */

class TimeCounterView extends CounterView
{
	public function new(container: DisplayObjectContainer, ?x: Float, ?y: Float, ?counter: Counter) 
	{
		super(container, x, y, counter);
	}

	
	override function SetValue(value: Int)
	{		
		var s: Int = Math.floor(value / 1000);
		var m: Int = Math.floor(s / 60);
		var h: Int = Math.floor(m / 60);
		
		m -= (h * 60);		
		s -= ((h * 3600) + m * 60);
	
		var str: String = IntToStr(h, 2) + ":" + IntToStr(m, 2) + ":" + IntToStr(s, 2);
		
		text = str;
		
		if (mStringFormat.length > 0) {
			text = StringTools.replace(mStringFormat, "%%", str);
		}
				
		Decorate();		
	}	
}